import { Burst } from "cc"
import { EnemyManager } from "../Base/EnemyManager"
import Singleton from "../Base/Singleton"
import { ILevel, ITile } from "../Levels"
import { DoorManager } from "../Scripts/Door/DoorManager"
import { PlayerManager } from "../Scripts/Player/PlayerManager"
import { TileManager } from "../Scripts/Tile/TileManager"
import { BurstManager } from "../Scripts/Burst/BurstManager"
import { SpikesManager } from "../Scripts/Spikes/SpikesManager"
import { SmokeManager } from "../Scripts/Smoke/SmokeManager"

// Omit： 从 ILevel 中排除 mapInfo 属性
export type IRecord = Omit<ILevel, 'mapInfo'>

export default class DataManager extends Singleton {
    static get Instance() {
        return super.GetInstance<DataManager>()
    }

    mapInfo: Array<Array<ITile>>
    tileInfo: Array<Array<TileManager>>
    mapRowCount: number = 0
    mapColumnCount: number = 0
    levelIndex: number = 1
    player: PlayerManager
    door: DoorManager
    enemies: EnemyManager[]
    bursts: BurstManager[]
    spikes: SpikesManager[]
    smokes: SmokeManager[]
    records: IRecord[] // 撤回数据用的数组

    reset() {
        this.mapInfo = []
        this.tileInfo = []
        this.player = null
        this.door = null
        this.enemies = []
        this.bursts = []
        this.spikes = []
        this.smokes = []
        this.records = []
        this.mapRowCount = 0
        this.mapColumnCount = 0
    }
}
